<template>
	<view class="main">
		<input type="text" placeholder="请输入您的钱包地址,0X...." v-model="address"/>
		<button type="primary" @tap="bindWalletAddress">确定</button>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				address:''
			}
		},
		onShow() {
			this.getMyInfo()
		},
		methods: {
			getMyInfo(){
				this.$ajax('bi/getMyInfo',{
					userId:uni.getStorageSync('userinfo').userId
				},"POST").then(res => {
					this.address=res.data.member.walletAddress || ''
				});
			},
			bindWalletAddress(){
				if(this.address==''){
					this.$sToast('地址不能为空')
					return
				}
				this.$ajax('bi/bindWalletAddress',{
					userId:uni.getStorageSync('userinfo').userId,
					address:this.address
				},"POST").then(res => {
					this.$sToast('绑定成功')
					this.$back(1,1500)
				});
			}
		}
	}
</script>

<style lang="scss">
page{
	background: #f4f4f4;
}
input{
	line-height: 80rpx;
	height: 80rpx;
	border-bottom: 1rpx solid #f4f4f4;
	margin-bottom: 80rpx;
}
.main{
	padding: 40rpx 30rpx;
	background: #FFFFFF;
}
</style>
